﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace JzSport.WebApp.Module_APP_AD
{
    public partial class MacNicknameList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ctlBtnCreate_Click(object sender, EventArgs e)
        {
            string os = ctlListOS.SelectedValue.Trim();
            string mac = ctlEditMAC.Text.Trim();
            string name = ctlEditName.Text.Trim();

            if(string.IsNullOrEmpty(os)
                || string.IsNullOrEmpty(mac)
                || string.IsNullOrEmpty(name))
            {
                return;
            }
            if (new Jiz.App.Domain.Services.CreateService().CreateMACNickname(os, mac, name))
            {
                ctlBtnQuery_Click(null, null);
            }
        }

        protected void ctlBtnQuery_Click(object sender, EventArgs e)
        {
            List<Jiz.App.Domain.Models.MACNickname> list = new Jiz.App.Domain.Services.QueryService().QueryMACNicknameList();
            _ctlList.DataSource = list;
            _ctlList.DataBind();
        }
    }
}